package ModelLayer;		//makes this class a part of the ModelLayer package

/**
 * Write a description of class SalePartOrder here.
 * @author (ucn-1semprojekt-dm78-gruppe1) 
 */
public class PartOrder
{
    private int amount;
    private SaleItem saleItem;
    private RentItem rentItem;
    private double subTotal;
    private int quantityDiscount;

    /**
     * Constructor for objects of class PartOrder
     */
    public PartOrder(int amount, SaleItem saleItem, RentItem rentItem, double subTotal, int quantityDiscount)
    {
        this.amount = amount;
        this.saleItem = saleItem;
        this.rentItem = rentItem;
        this.subTotal = subTotal;
        this.quantityDiscount = quantityDiscount;
    }

    /**
     * Get amount of items
     * @return amount
     */
    public int getAmount()
    {
        return amount;
    }
    
    /**
     * Get the saleitem

     * @return saleItem
     */
    public SaleItem getSaleItem()
    {
        return saleItem;
    }
    
    /**
     * Get the rentItem
     * @return rentItem
     */
    public RentItem getRentItem()
    {
        return rentItem;
    }
    
    /**
     * Get the subtotal
     * @return subTotal
     */
    public double getSubTotal()
    {
        return subTotal;
    }
    
    /**
     * Set amount of items
     * @param newAmount
     */
    public void setAmount(int newAmount)
    {
        amount = newAmount;
    }
    
    /**
     * Set saleitems
     * @param newSaleItem
     */
    public void setSaleItem(SaleItem newSaleItem)
    {
        saleItem = newSaleItem;
    }
    
    /**
     * Set rentitems
     * @param newRentItem
     */
    public void setRentItem(RentItem newRentItem)
    {
        rentItem = newRentItem;
    }
    
    /**
     * Set the subtotal
     * @param newSubTotal
     */
    public void setSubTotal(double newSubTotal)
    {
        subTotal = newSubTotal;
    }
    
    /**
     * Calculate the subtotal of amount * price of item
     * @return subTotal
     */
    public double calculateSubTotal()
    {
        subTotal = amount * saleItem.getPrice();
        return subTotal;
    }
    
    public int getQuantityDiscount()
    {
        return quantityDiscount;
    }
    
    
    public void setQuantityDiscount(int quantityDiscount)
    {
        this.quantityDiscount = quantityDiscount;
    }
    
    public int calculateQuantityDiscount()
    {
    	switch(amount)
    	{
    		case 10: quantityDiscount = 5; break;
    		case 50: quantityDiscount = 10; break;
    		case 100: quantityDiscount = 15; break;
    	}
    	
    	return quantityDiscount;
    }
}
